function wagediff = wagediff(sbar,stilde,p)

% compute set of automated tasks:
rauto = automation(sbar,stilde,p);

% compute wages:
rlab = laborassignment(sbar,stilde,rauto.xlow,rauto.xup,p);

% compute difference in wages of stilde between xup and xlow:
wagediff = rlab.wtop(1)-rlab.wbottom(end);

end